<template>
  <el-dialog :append-to-body="true" :visible.sync="dialog" :title="'添加'" width="500px">
    <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
      <div>
        <el-form-item label="名称" prop="name">
          <el-input v-model="form.name" style="width: 370px;"/>
        </el-form-item>
      </div>
      <div>
        <el-form-item label="IMEI" prop="name">
          <el-input v-model="form.name" style="width: 370px;"/>
        </el-form-item>
        <el-form-item label="选择网关" prop="name">
          <el-input v-model="form.name" style="width: 370px;"/>
        </el-form-item>
        <el-form-item label="设备地址" prop="name">
          <el-input v-model="form.name" style="width: 370px;"/>
        </el-form-item>
      </div>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="text" @click="cancel">取消</el-button>
      <el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "addnet",
  data() {
    return {
      dialog: false,
      loading: false,
      form: {
        name: ""
      },
      rules: {
        name: [{ required: true, message: "请输入名称", trigger: "blur" }]
      }
    };
  },
  methods: {
    cancel() {},
    doSubmit() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.dialog = false;
          console.log(this.$refs);
          console.log(this.$parent.value);
        }
      });
    }
  }
};
</script>

<style lang="scss">
</style>
